﻿using Mrc.Config;
using Mrc.RabbitMQ;
 
namespace Microsoft.Extensions.DependencyInjection
{
    public static class RabiitMQServiceCollectionExtentions
    {
        public static void AddRabbitBaseService(this IServiceCollection services)
        {
            services.AddSingleton<IConnectionPool, ConnectionPool>();
            services.AddSingleton<IRabbitmqPublish, RabbitmqPublish>();
            services.AddTransient<INodeHealthCheckService,NodeHealthCheckService>();
        }
        public static void AddRabbitMQConsumer(this IServiceCollection services)
        {
            AddRabbitBaseService(services);
            services.AddHostedService<RabbitmqConsumer>();            
        } 
    }
}
